import { Button } from 'antd';
export default {
	name: 'DemoDialog',
	isJiess: true,
	setup() {
		let level = 1;
		const dialog = this.dialog();
		const area = this.area({ title: '无限弹框示例' });
		const config = show => ({
			okType: 'primary',
			okText: '新弹出一层',
			cancelText: '关闭当前层',
			title: `当前层级【第${level++}层】`,
			onOk: () => dialog.open(config),
			onCancel() {
				show.value = false;
			},
			children: this.render({
				is: Button,
				children: '关闭所有层',
				onClick: () => {
					level = 1;
					dialog.closeAll();
				},
			})
		});

		area.add(
			this.render({
				is: Button,
				type: 'primary',
				children: '开启无限弹框',
				onClick: () => dialog.open(config)
			})
		).done()
	}
}